<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="i1">
<input type="text" id="i2">
<input type="button" value="加" onclick="f(a)" id="a">
<input type="button" value="减" onclick="f(b)" id="b">
<input type="button" value="乘" onclick="f(c)" id="c">
<input type="button" value="除" onclick="f(d)" id="d">
<h3>
  结果：<span></span>
</h3>
</body>
<script>
let i1 = document.querySelector("#i1")
let i2 = document.querySelector("#i2")
let s = document.querySelector("span")
let id = document.querySelector("")
function f() {
    if (id == a) {
        s.innerText = i1.value * 1 + i2.value * 1;
    } else if (id == b) {

    }
}
</script>
</html>